import random
import string

def random_str(num):
    # 有没有可能会出现若干个一样的字符呢？
    result = ''.join(random.sample(string.ascii_letters + string.digits, num))
    return result


tmp = input('输入随机字符串的长度,范围0～62:')
num = int(tmp)
if num >= 0 and num <= 62:
    str1 = random_str(num)
    print('%s位随机字符串' % num,str1)
else:
    print('超出随机字符串范围')
